﻿-- =============================================
-- Author:		Hong Thanh
-- Create date: 15/4/2014
-- Description:	Lay danh sach cac ty gia hien thoi cua selling
-- =============================================
ALTER PROCEDURE [dbo].[sp_Thanh_GetSellingCurrList] 
	@idHBL int
AS
BEGIN
	select distinct c.ID_Currency, c.Code, h.Ratio
	from (select * from tblSellingFee where ID_HBL=@idHBL and UnitPrice<>0) as s
		left join tblCurrency as c on c.ID_Currency = s.ID_Currency
		left join tblHBLExchange h on h.ID_HBL = @idHBL and c.ID_Currency = h.ID_Currency
	where c.Code <> 'VND'
END
go
-- =============================================
-- Author:		Hong Thanh
-- Create date: 15/4/2014
-- Description:	Lay danh sach cac selling fee
-- =============================================
ALTER PROCEDURE [dbo].[sp_Thanh_GetSellingRateList_2] 
	@idHBL int
AS
BEGIN
	select f.FeeName, s.UnitPrice, s.Quantity, s.Price,c.ID_Currency, s.Description, s.ID_SellingFee
	from tblFee as f, tblCurrency as c, tblSellingFee as s
	where f.ID_Fee = s.ID_Fee and s.ID_HBL = @idHBL and c.ID_Currency = s.ID_Currency
	and s.UnitPrice<>0
	order by f.[Rank]
END
